<?php
class CommentViewModel extends Model
{
	protected $viewModel = true;
	 
	// 视图模型中的字段定义 
	protected $viewFields = array( 
		"Comments"=>array("comment_ID", "comment_post_ID", "comment_author", "comment_author_email", "comment_author_url", "comment_author_IP", "comment_date", "comment_content", "comment_approved"),
		"Posts"=>array("post_date","post_title")		
	); 

	// 视图关联的where条件 
	protected $viewCondition = array(
		"Comments.comment_post_ID" => array("eqf","Posts.ID")
	);
	
	// 视图模型的主键
	Public function getPk() { 
		return "Comments.comment_post_ID"; 
	}
}
?>